package com.onpositive.rest.model;

import java.util.LinkedHashMap;

public class Resource {
	
	private String url;
	
	private String description;
	
	private LinkedHashMap<String,Method> methods = new LinkedHashMap<String, Method>();
	
	private LinkedHashMap<String,Resource> childResources = new LinkedHashMap<String, Resource>();

	private int level;

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public LinkedHashMap<String, Method> getMethods() {
		return methods;
	}

	public void setMethods(LinkedHashMap<String, Method> methods) {
		this.methods = methods;
	}

	public LinkedHashMap<String, Resource> getChildResources() {
		return childResources;
	}

	public void setChildResources(LinkedHashMap<String, Resource> childResources) {
		this.childResources = childResources;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((childResources == null) ? 0 : childResources.hashCode());
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		result = prime * result + ((methods == null) ? 0 : methods.hashCode());
		result = prime * result + ((url == null) ? 0 : url.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Resource other = (Resource) obj;
		if (childResources == null) {
			if (other.childResources != null)
				return false;
		} else if (!childResources.equals(other.childResources))
			return false;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (methods == null) {
			if (other.methods != null)
				return false;
		} else if (!methods.equals(other.methods))
			return false;
		if (url == null) {
			if (other.url != null)
				return false;
		} else if (!url.equals(other.url))
			return false;
		return true;
	}

	public void setLevel(int level) {
		this.level = level;		
	}

	public int getLevel() {
		return level;
	}


}
